/**
 * 函数类型 ——1.为函数定义类型
 */
function add(x, y) {
    return x + y;
}
var myAdd = function (x, y) { return x + y; };
/**
 * 函数类型 ——2.完整的函数类型
 */
var myAddTo1 = function (x, y) {
    return x + y;
};
/**
 * 可选参数和默认参数
 */
function buildName(firstName, lastName) {
    if (lastName) {
        return firstName + " " + lastName;
    }
    return firstName;
}
var result1 = buildName("Bob");
// let result2 = buildName("Bob","Adams","Sr"); //应有 1-2 个参数，但获得 3 个。
var result3 = buildName("Bob", "Adams");
function buildNameTo1(firstName, lastName) {
    if (lastName === void 0) { lastName = "Jack"; }
    return firstName + " " + lastName;
}
var resultTo1 = buildNameTo1("Bob");
var resultTo2 = buildNameTo1("Bob", undefined);
// let resultTo3 = buildNameTo1("BOb","Adams","SR.")  //应有 1-2 个参数，但获得 3 个。
var resultTo4 = buildNameTo1("Bob", "Adams");
/**
 * 剩余参数
 */
function buildNameTo2(firstName) {
    var restofName = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        restofName[_i - 1] = arguments[_i];
    }
    return firstName + " " + restofName.join("");
}
var employeeName = buildNameTo2("Joseph", "Samuel", "Lucas", "MackInzie");
function buildNameTo3(firstName) {
    var props = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        props[_i - 1] = arguments[_i];
    }
    console.log(props[0]);
}
var jian = function (x, y) {
    return x - y;
};
var employeeNameTo1 = buildNameTo3("Dsa", jian, "Ds", 2);
